package com.alibaba.citrus.cr.mn.order.center.autofulfillmentorder.service.impl;

import com.alibaba.citrus.cr.mn.order.center.autofulfillmentorder.service.AutoFulfillmentOrderBizQueryService;
import com.alibaba.cz.base.tool.log.Log;
import com.epoch.app.crforecastsales.domian.cfsbcautofulfillmentorderrecords.dto.CountRequest;
import com.epoch.app.crforecastsales.domian.cfsbcautofulfillmentorderrecords.dto.CountResponse;
import com.epoch.app.crforecastsales.domian.cfsbcautofulfillmentorderrecords.dto.QueryForListRequest;
import com.epoch.app.crforecastsales.domian.cfsbcautofulfillmentorderrecords.dto.QueryForListResponse;
import com.epoch.app.crforecastsales.domian.cfsbcautofulfillmentorderrecords.model.CfsBcAutoFulfillmentOrderRecords;
import com.epoch.app.crforecastsales.domian.cfsbcautofulfillmentorderrecords.service.CfsBcAutoFulfillmentOrderRecordsService;
import com.google.common.collect.Lists;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author baizhuo
 * @version 1.0
 * @date 2023/8/22 10:38
 */
@Service
public class AutoFulfillmentOrderBizQueryServiceImpl implements AutoFulfillmentOrderBizQueryService {

    private static final Log log = Log.getLogger(AutoFulfillmentOrderBizQueryService.class);

    @Resource
    private CfsBcAutoFulfillmentOrderRecordsService cfsBcAutoFulfillmentOrderRecordsService;

    @Override
    public List<CfsBcAutoFulfillmentOrderRecords> queryForList(QueryForListRequest queryForListRequest) {
        if (null == queryForListRequest) {
            return Lists.newArrayList();
        }
        QueryForListResponse queryForListResponse = cfsBcAutoFulfillmentOrderRecordsService.queryForList(queryForListRequest);
        return queryForListResponse.getResult();
    }

    @Override
    public int count(CountRequest countRequest) {
        if (null == countRequest) {
            return 0;
        }
        CountResponse response = cfsBcAutoFulfillmentOrderRecordsService.count(countRequest);
        return Integer.valueOf(response.getResult());
    }
}
